<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
<h:body>
	<ui:composition template="/WEB-INF/templates/template.xhtml">
		<ui:define name="content">
			<h:form id="form">
				<p:growl id="growl" sticky="false" autoUpdate="true"
					showDetail="true" />
				<p:panel header="#{msg.title_cat_role_child}">
					<p:commandButton value="#{msg.ver}" icon="ui-icon-search"
						actionListener="#{ncr_controller.preViewItem}"
						oncomplete="PF('dlgView').show();"
						update=":formView:outputPanel_view" />
					<p:commandButton value="#{msg.edit}" icon="ui-icon-pencil"
						action="#{ncr_controller.onEditRole}" />
					<br />
					<p:dataTable value="#{ncr_controller.itemsList}" var="item"
						rows="10" paginator="true"
						currentPageReportTemplate="{startRecord} de {endRecord}"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="5,10,15" paginatorPosition="bottom"
						resizableColumns="true" selection="#{ncr_controller.currentItem}"
						rowKey="#{item.idChild}" id="table">
						<p:column selectionMode="single"
							style="width:16px;text-align:center" />
						<p:column headerText="#{msg.id}" sortBy="#{item.idChild}"
							filterBy="#{item.idChild}">
							<h:outputText value="#{item.idChild}" />
						</p:column>
						<p:column headerText="#{msg.text}" sortBy="#{item.text}"
							filterBy="#{item.text}">
							<h:outputText value="#{item.text}" />
						</p:column>
						<p:column headerText="#{msg.outcome}" sortBy="#{item.outcome}"
							filterBy="#{item.outcome}">
							<h:outputText value="#{item.outcome}" />
						</p:column>
						<p:column headerText="#{msg.url}" sortBy="#{item.url}"
							filterBy="#{item.url}">
							<h:outputText value="#{item.url}" />
						</p:column>
					</p:dataTable>
				</p:panel>
			</h:form>
			<!-- Panel for view -->
			<p:dialog header="#{msg.detail}" widgetVar="dlgView"
				style="position:fixed;">
				<h:form id="formView">
					<p:outputPanel id="outputPanel_view">
						<h:panelGrid columns="2" id="panelgrid_view">
							<p:outputLabel value="#{msg.id}" for="current_item_view_id" />
							<h:outputText value="#{ncr_controller.currentItem.idChild}"
								id="current_item_view_id" />
							<p:outputLabel value="#{msg.text}" for="current_item_view_dsc" />
							<h:outputText value="#{ncr_controller.currentItem.text}"
								id="current_item_view_dsc" />
							<p:outputLabel value="#{msg.roles}" for="current_item_roles" />
							<h:outputText value="#{ncr_controller.rolesAsigned}"
								id="current_item_roles" />
						</h:panelGrid>
						<div style="float: right;">
							<p:commandButton value="#{msg.accept}"
								onclick="PF('dlgView').hide();" type="button"
								icon="ui-icon-check" />
						</div>
					</p:outputPanel>
				</h:form>
			</p:dialog>
			<!-- End panel for view -->
		</ui:define>
	</ui:composition>

</h:body>
</html>